﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Xin478.CSWork.Common
{
    public class Rights
    {
        private Dictionary<string, ActionInfo> _actions;
        public Rights(Dictionary<string, ActionInfo> actions)
        {
            _actions = actions;
        }
        public bool Read(string action)
        {
            return _actions != null && _actions.ContainsKey(action) && _actions[action].RightInfo.Read;
        }
        public bool Add(string action)
        {
            return _actions != null && _actions.ContainsKey(action) && _actions[action].RightInfo.Add;
        }
        public bool Modify(string action)
        {
            return _actions != null && _actions.ContainsKey(action) && _actions[action].RightInfo.Modify;
        }
        public bool Delete(string action)
        {
            return _actions != null && _actions.ContainsKey(action) && _actions[action].RightInfo.Delete;
        }
    }
}
